<?php

class Childpanel extends Controller
{
	function Childpanel()
	{
		parent::Controller();
		$this->load->helper('url');
        $this->load->helper('form');
        $this->load->helper('email');
	}
	
	
	function index()
	{	
	}
	
	
	function child($imie, $nazwisko)
	{
		
		if(NULL ==  getenv('HTTP_REFERER'))
		{
			echo "NASTĄPIŁA PRÓBA WYŁUDZENIA INFORMACJI !";
		}
		else
		{
			$query = "SELECT c.name AS klasa, s.id AS id FROM students s, classes c WHERE s.classe_id = c.id AND s.firstname ='" . $imie . "' AND s.secondname ='" . $nazwisko . "'";
			$query = $this->db->query($query);
		
			foreach ($query->result() as $row)
    		{
    			$klasa = $row->klasa;
    			$id = $row->id;
        	}
        
			$tablica = array('imie' => $imie, 'nazwisko' => $nazwisko, 'klasa' => $klasa, 'id' => $id);
			$this->load->view("childpanel_view", $tablica);
		}
	}
}

?>